package com.cole.gx095.Repository;

import com.cole.gx095.entity.Purchasecontract;
import com.cole.gx095.entity.Salecontract;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

public interface SalecontractRepository extends JpaRepository<Salecontract,Integer>, JpaSpecificationExecutor<Salecontract> {
    @Query(value = "select sum(contractAmount) from salecontract", nativeQuery = true)
    Long sumAmount();

    @Query(value = "select * from salecontract p where p.contractNum = ?1", nativeQuery = true)
    Salecontract findoneBycontractNum(String contractNum);
}
